<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">编辑门店</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 门店名称 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="shop[shop_name]"
                                           placeholder="请输入门店名称" value="<?= $model['shop_name']?>" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 门店logo </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
												<div class="file-item">
													<img src="<?= $model['logo']['file_path'] ?>">
													<input type="hidden" name="shop[logo_image_id]"
															   value="<?= $model['logo_image_id'] ?>">
													<i class="iconfont icon-shanchu file-item-delete"></i>
												</div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="am-form-group am-padding-top">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 联系人 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="shop[linkman]"
                                           placeholder="请输入门店联系人" value="<?= $model['linkman']?>" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 联系电话 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="shop[phone]"
                                           placeholder="请输入门店联系电话" value="<?= $model['phone']?>" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 营业时间 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="shop[shop_hours]"
                                           placeholder="请输入门店营业时间" value="<?= $model['shop_hours']?>" required>
                                    <small>例如：8:30-17:30</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 详细地址 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="shop[address]"
                                           placeholder="请输入详细地址" value="<?= $model['address']?>" required>
									<small>不用填写省、市、区/县</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 门店坐标 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-block">
                                        <input type="text" style="background: none !important;" id="coordinate"
                                               class="tpl-form-input" name="shop[coordinate]" placeholder="请选择门店坐标" 
											   value="<?= $model['coordinate']?>" readonly="" required>
                                    </div>
                                    <div class="am-block am-padding-top-xs">
                                        <iframe id="map" src="index.php?s=/store/plugins.shop/getpoint"
                                                width="915"
                                                height="610"></iframe>
                                    </div>
                                </div>
                            </div>
                            <div class="am-form-group am-padding-top">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label"> 门店简介 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <textarea class="am-field-valid" rows="5" placeholder="请输入门店简介"
                                              name="shop[summary]"><?= $model['summary']?></textarea>
                                </div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">点餐模式 </label>
                                <div class="am-u-sm-9 am-u-end">
									<label class="am-checkbox-inline">
                                        <input type="checkbox" name="shop[food_mode][]" value="9" 
										<?php foreach($model['food_mode'] as $item): if($item==9):?>
											checked
										<?php endif; endforeach;?>
										data-am-ucheck required>
                                            扫一扫
									</label>
                                    <label class="am-checkbox-inline">
                                        <input type="checkbox" name="shop[food_mode][]" value="1" 
										<?php foreach($model['food_mode'] as $item): if($item==1):?>
											checked
										<?php endif; endforeach;?>
										data-am-ucheck required>
                                            店内就餐
									</label>
									<label class="am-checkbox-inline">
                                        <input type="checkbox" name="shop[food_mode][]" value="2" 
										<?php foreach($model['food_mode'] as $item): if($item==2):?>
											checked
										<?php endif; endforeach;?>
										data-am-ucheck required>
                                            打包自取
									</label>
									<label class="am-checkbox-inline">
                                        <input type="checkbox" name="shop[food_mode][]" value="3" 
										<?php foreach($model['food_mode'] as $item): if($item==3):?>
											checked
										<?php endif; endforeach;?>
										data-am-ucheck required>
                                            外卖直达
									</label>
                                    <div class="help-block">
                                        <small>小程序首页的点餐选项，必选一项</small>
                                    </div>
                                </div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">堂食模式 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="shop[tang_mode]" value="1" data-am-ucheck 
										<?= $model['tang_mode'] == 1?'checked':''?>>
                                        选桌点餐
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="shop[tang_mode]" value="2" data-am-ucheck 
										<?= $model['tang_mode'] == 2?'checked':''?>>
                                        排号点餐
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 自提核销 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="shop[is_check]" value="1" data-am-ucheck 
										<?= $model['is_check']['value'] == 1?'checked':''?>>
                                        开启
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="shop[is_check]" value="0" data-am-ucheck 
										<?= $model['is_check']['value'] == 0?'checked':''?>>
                                        关闭
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 门店状态 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="shop[status]" value="1" data-am-ucheck
                                               <?= $model['status']['value'] == 1?'checked':''?>>
                                        营业中
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="shop[status]" value="0" data-am-ucheck 
										<?= $model['status']['value'] == 0?'checked':''?>>
                                        歇业中
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">显示排序 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="number" class="tpl-form-input" name="shop[sort]"
                                           value="<?= $model['sort']?>" required>
                                    <small>数字越小越靠前</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 图片文件列表模板 -->
{{include file="layouts/_template/tpl_file_item" /}}
<!-- 文件库弹窗 -->
{{include file="layouts/_template/file_library" /}}
<script>
    /**
     * 设置坐标
     */
    function setCoordinate(value) {
        var $coordinate = $('#coordinate');
        $coordinate.val(value);
        // 触发验证
        $coordinate.trigger('change');
    }
	
    $(function () {

        // 选择图片
        $('.upload-file').selectImages({
            name: 'shop[logo_image_id]'
        });

        $('#my-form').formPost();

    });
</script>
